<html><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	  <title>会员中心 - 修改密码 - {muy:siteseo name='title'}</title>
	   <meta name="keywords" content="{muy:siteseo name='key'}" />
      <meta name="description" content="{muy:siteseo name='desc'}" />
	  <link href="__INDEXST__user/static/css/member_index.css" rel="stylesheet" type="text/css">
	  <link rel="stylesheet" href="__INDEXST__user/static/layer/theme/default/layer.css?v=3.1.1" id="layuicss-layer">
	  <link href="__INDEXST__user/static/icon/iconfont.css" rel="stylesheet" type="text/css" />
	  <script type="text/javascript" src="__INDEXST__user/static/js/jquery-1.8.2.min.js"></script>
      <script type="text/javascript" src="__INDEXST__user/static/layer/layer.js"></script>
  </head>
	<!--头部-->
{include file='user/header'}
<!--头部end-->
<div class="yzm_member_container main">
    <!--侧边导航栏开始-->
      {include file='user/menu'}
      <!--侧边导航栏结束-->
   
      <div class="main_right">
        <div class="tit">
            <h3>修改密码</h3>
        </div>
        <div class="main_cont">
            <form method="post" action="" onsubmit="return chcekall(this)">
                <table>
                    <tbody><tr>
                        <td>原密码：</td>
                        <td><input type="password" id="oldpass" name="oldpass" value="" placeholder="原密码不低于6位" class="input"><span class="red">*</span></td>
                    </tr>
                    <tr>
                        <td>新密码：</td>
                        <td><input type="password" name="password" value="" placeholder="新密码不能低于6位" class="input"><span class="red">*</span></td>
                    </tr>
                    <tr>
                        <td>确认密码：</td>
                        <td><input type="password" name="password2" value="" placeholder="确认密码与新密码一致" class="input"><span class="red">*</span></td>
                    </tr>
                    <tr>
                        <td>验证码：</td>
                        <td><input type="text" placeholder="请输入验证码" class="input" required="" name="verif" id="captcha">
                            	<img style="margin-bottom: -10px;" id="verif_img" src="{:captcha_src()}" onclick="this.src=this.src+'?'+Math.random()" class="qrcode verifyimg" title="看不清，换一张"></td>
                        </tr>
                        <tr>
                        <td>邮箱验证码：</td>
                        <td><input type="text" class="input" name="email_code" id="email_code" placeholder="邮箱验证码">
            					 <a class="sendMail" onclick="send_code()"><span id="send_code">发送验证码</span><span id="send_show" style="display:none;">重新发送(60s)</span></a></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="submit" name="dosubmit" class="submit" value="提交"></td>
                    </tr>
                </tbody></table>
            </form>
        </div>
    </div>
</div>

	<!--底部开始-->
{include file='user/footer'}
<!--底部结束-->
<!--验证码发送触发样式开始-->
<style>
.sendMail>span{cursor: pointer;}
</style>
<!--验证码发送触发样式结束-->
<script type="text/javascript">
	  function chcekall(obj){
			if($("#email_code").val() == ''){
				layer.msg('邮箱验证码不能为空！', {icon:2,time: 1000});
				$("#email_code").focus();
				return false;
			}
	     
			var dosubmit = false;
			$.ajax({   
				type: "post",
				url: "{:url('User/update_passwds')}",   
				dataType: "json",
				async: false,
				data:  $(obj).serialize(),
				success: function(msg){  
					if(msg.code == 1){
						layer.msg(msg.msg, {icon:1,time: 3000});
						location.reload();
					}else{
							layer.msg(msg.msg, {icon:2,time: 2000});
					        $('#captcha+img').attr('src',$('#captcha+img').attr('src') + '?' + Math.random());
							$("#captcha").focus();
					}				 
				} 
			});
			return dosubmit ? true : false;
	  }
	  
	  
	    var time = 0;
		var res = null;
		function setmytime(){
			clearTimeout(res);
	        time--; 
	        if (time <= 0) {
	            $('#send_show').text("发送验证码");
	            clearTimeout(res);
	            time = 0;
	            return;
	        }
	        $('#send_show').text("重新发送(" + time + "s)");
	        res = setTimeout("setmytime()", 1000);
		}
		function send_code() {
		    if($('input[name="oldpass"]').val() == ''){
				layer.msg('原密码不能为空！', {icon:2});
				return false;
			}
			if($('input[name="password"]').val().length < 6){
				layer.msg('密码不能低于6位！', {icon:2});
				return false;
			}
			if($('input[name="password"]').val() != $('input[name="password2"]').val()){
				layer.msg('两次密码不一致！', {icon:2});
				return false;
			}
			if($('input[name="captcha"]').val() == ''){
				layer.msg('请输入验证码！', {icon:2});
				return false;
			}
		    
		    
			var code = $("#captcha").val()
			if(time==0){
				layer.msg('邮件发送中……', { icon: 16, shade: 0.21,shadeClose:true,time:2000 });
				$.ajax({   
					type: "post",   
					url: "{:url('User/sendCode_pass')}",   
					dataType: "json",
					async: false,	
					data: "email="+$("#email").val()+"&verif="+code+"&oldpass="+$("#oldpass").val(),		
					success: function(msg){  
						if(msg.code == 1){
							$("#send_code").css('display','none'); 
							$("#send_show").css('display','block'); 
							time = 60;
							res = setTimeout("setmytime()", 1000);	
							layer.msg(msg.msg, {icon:1,time: 3000});		  
						}else{
							layer.msg(msg.msg, {icon:2,time: 2000});
							$('#captcha+img').attr('src',$('#captcha+img').attr('src') + '?' + Math.random());
							$("#captcha").focus();
						}				 
					} 
				});
			}else{
				layer.msg('请 ' + time + ' 秒后再发送！', {icon:2,time: 2000});
			}
		}
</script>

  
</body>
</html>